// 简单版 get，eg: get({a:{b:1}}, 'a.b') === 1，后期如果代码多了引入 lodash
const simpleGet: (obj: any, path: string, defaultValue?: any) => void = (obj, path, defaultValue) => {
  const parts = path.split('.');
  let result = obj;
  for (const part of parts) {
    result = result?.[part];
    if (result === undefined) {
      return defaultValue;
    }
  }
  return result;
}

export {
  simpleGet
}